package com.u2ds.dss.tools;

import com.u2ds.core.constants.ResultConstant;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Ethan.Yuan on 2017/2/3.
 */
public class ResultTool {
    
    public static Map<String, Object> success(){
        return ResultTool.success(ResultConstant.SUCCESS_MSG);
    }

    public static Map<String, Object> success(String msg){
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("code", ResultConstant.SUCCESS);
        result.put("msg", msg);
        return result;
    }

    public static Map<String, Object> failed(){
        return ResultTool.failed(ResultConstant.FAILED_MSG);
    }

    public static Map<String, Object> failed(String msg){
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("code", ResultConstant.FAILED);
        result.put("msg", msg);
        return result;
    }
}
